package com.balakitbbs.controller;

import org.springframework.beans.factory.annotation.Autowired; 
import java.util.*;               
import org.springframework.stereotype.Controller;               
import org.springframework.web.bind.annotation.PathVariable;               
import org.springframework.web.bind.annotation.RequestMapping;               
import org.springframework.web.servlet.ModelAndView;               
import com.balakitbbs.page.Page;               
import com.balakitbbs.page.SearchPageUtil;               
import com.balakitbbs.service.Bala_person_tagService;
import com.balakitbbs.entity.Bala_person_tag;
   /**
    * bala_person_tag Controller类
    */ 
@Controller
public class Bala_person_tagController{
	@Autowired
	private Bala_person_tagService bala_person_tagservice;

//增加人员标签关系表
@RequestMapping("/page/{pageIndex}/{pageSize}/addBala_person_tag")
public String addBala_person_tag(Bala_person_tag bala_person_tag,@PathVariable Integer pageIndex,@PathVariable Integer pageSize){
	bala_person_tag.setCdate(new Date());
	bala_person_tag.setId(UUID.randomUUID().toString());
	bala_person_tagservice.addBala_person_tag(bala_person_tag);
	return "redirect:/page/"+pageIndex+"/"+pageSize+"/selectBala_person_tag.do";
}


//删除人员标签关系表
@RequestMapping("/page/{Id}/{pageIndex}/{pageSize}/delBala_person_tag")
public String delBala_person_tag(@PathVariable String Id,@PathVariable Integer pageIndex,@PathVariable Integer pageSize){
	bala_person_tagservice.delBala_person_tag(Id);
	return "redirect:/page/"+pageIndex+"/"+pageSize+"/selectBala_person_tag.do";
}


//修改人员标签关系表
@RequestMapping("/page/{pageIndex}/{pageSize}/updateBala_person_tag")
public String updateBala_person_tag(Bala_person_tag bala_person_tag,@PathVariable Integer pageIndex,@PathVariable Integer pageSize){
	bala_person_tag.setUdate(new Date());
	bala_person_tagservice.updateBala_person_tag(bala_person_tag);
	return "redirect:/page/"+pageIndex+"/"+pageSize+"/selectBala_person_tag.do";
}


//查询人员标签关系表
@RequestMapping("/page/{pageIndex}/{pageSize}/selectBala_person_tag")
public ModelAndView selectBala_person_tags(Bala_person_tag bala_person_tag,@PathVariable Integer pageIndex,@PathVariable Integer pageSize){
	ModelAndView modelAndView = new ModelAndView();
	int selectBala_person_tagCount = bala_person_tagservice.selectBala_person_tagsByPOJOCount(bala_person_tag);
	Page page = new Page(pageIndex, pageSize, selectBala_person_tagCount);
	SearchPageUtil spu = new SearchPageUtil();
	spu.setPage(page);
	modelAndView.addObject("data", bala_person_tagservice.selectBala_person_tagsByPojoPage(spu, bala_person_tag));
	modelAndView.addObject("page", page);
	modelAndView.addObject("s", 1);
	modelAndView.addObject("po", new Bala_person_tag());
	modelAndView.setViewName("/WEB-INF/page/bala_person_tag.jsp");
	return modelAndView;
}

}

